package homeWork.four.demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2022-11-30
 * Time: 18:33
 */
public class Person {
    private String name;
    private int id;

    public Person(String name, int id) {
        this.name = name;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", id=" + id +
                '}';
    }

    //2.定义Person类，要求包含姓名和身份证号，定义相应的Getters和Setters
    //方法实现对Person相关信息的读写操作。
    public static void main(String[] args) {
        Person person = new Person("张三",156);
        System.out.println(person);
        person.setId(456);
        person.setName("王五");
        System.out.println(person);
    }
}
